/**
 * 获取字符串字节长度
 * @param {String}
 * @returns {Boolean}
 */
// 检查字节长度
function checkLength(v: string): number {
  let realLength = 0;
  // tslint:disable-next-line: prefer-const
  let len = v.length;
  for (let i = 0; i < len; i++) {
    const charCode = v.charCodeAt(i);
    if (charCode >= 0 && charCode <= 128) realLength += 1;
    else realLength += 2;
  }
  return realLength;
}

export default checkLength;
